package gdut.jmxywz.action;

import gdut.jmxywz.interceptor.AuthenticationInterceptor;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;

public class LoginOutAction extends BaseAction {
	private AuthenticationInterceptor authenticationInterceptor;
	private Map                       session;
	
	
	public AuthenticationInterceptor getAuthenticationInterceptor() {
		return authenticationInterceptor;
	}


	public void setAuthenticationInterceptor(
			AuthenticationInterceptor authenticationInterceptor) {
		this.authenticationInterceptor = authenticationInterceptor;
	}


	public Map getSession() {
		return session;
	}


	public void setSession(Map session) {
		this.session = session;
	}


	public String execute()throws Exception{
		
		session = ActionContext.getContext().getSession();
		if(session!=null){
			session.put(authenticationInterceptor.TEACHER_SESSION_KEY, null);
			session.put(authenticationInterceptor.STUDENT_SESSION_KEY, null);
			return SUCCESS;
		}
		return SUCCESS;
    
	}

}
